package com.tien.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tien.dao.MenuDao;
import com.tien.model.Menu;
import com.tien.service.MenuService;

/**
 * @author tienxin
 * @E-mail g.tianxin@gmail.com
 * @version 2012-2-19 上午01:44:44
 */
@Service
public class MenuServiceImpl implements MenuService {

	@Autowired
	private MenuDao menusDao;

	@Override
	public List<Menu> findAllMenus(Long menuGroupId) {
		// TODO Auto-generated method stub
		return menusDao.findAllMenus(menuGroupId);
	}
	
	//@PreAuthorize("hasRole('ROLE_ADMIN')")
	@Override
	public Long updateMenu(Menu menu) {
		// TODO Auto-generated method stub
		return menusDao.saveMenu(menu);
	}

	@Override
	public Menu findMenuById(Long id) {
		// TODO Auto-generated method stub
		return menusDao.findMenuById(id);
	}

	//@PreAuthorize("hasRole('ROLE_ADMIN')")
	@Override
	public Long addMenu(Menu menu) {
		// TODO Auto-generated method stub
		return menusDao.addMenu(menu);
	}

	//@PreAuthorize("hasRole('ROLE_ADMIN')")
	@Override
	public void deleteMenuById(Long id) {
		menusDao.deleteMenuById(id);
	}

}
